package com.bw.unit3.http

import com.blankj.utilcode.util.SPUtils
import okhttp3.Interceptor
import okhttp3.Response

/**
 *
 * @ClassName: TokenInterceptor
 * @Description: 统一添加token参数至header
 * @Author: zhangyanchao
 * @CreateDate: 2024/9/13 5:28 PM
 * @Version: 1.0
 */
class TokenInterceptor : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val request = chain.request().newBuilder()
            .addHeader("token", SPUtils.getInstance().getString("token"))
            .build()
        return chain.proceed(request)
    }
}